//
//  BaseVM.swift
//  chat
//
//  Created by 1 on 2023/3/31.
//

import Foundation
import ObjectMapper

class BaseVM<T: BaseModel>: ObservableObject {
    // 数据列表
    @Published var items: [T] = []
    // 详情
    @Published var item: T = BaseModel() as! T
    
    @Published var isShowingLoginPage:Bool = false//登录页控制
    @Published var isShowingOpenVIPPage:Bool = false//开通VIP页控制
    
    @Published var isLogin = AIUserAccount.hasAccessToken
//    @Published var isVIP = AIUserAccount.vip
    
    var isViewAppearNotRequestData:Bool = false//默认需要请求
    
    init(items: [T], item: T) {
        self.items = items
        self.item = item
    }
    
    init(){
        self.items = []
        self.item = BaseModel() as! T
    }
    
    func appear(){
        isLogin = AIUserAccount.hasAccessToken
//        isVIP = AIUserAccount.vip
    }
}
